package com.samsung.sds.test.editors;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.jface.text.rules.DefaultPartitioner;
import org.eclipse.ui.editors.text.FileDocumentProvider;


public class JSPDocumentProvider extends FileDocumentProvider {
	private final static String[] TYPES = new String[] { 
		HTMLPartitionScanner.HTML_COMMENT, 
		HTMLPartitionScanner.HTML_TAG, 
		HTMLPartitionScanner.JAVASCRIPT}; 

	public JSPDocumentProvider(){
		super();
	}
	
	protected IDocument createDocument(Object element) throws CoreException {
		IDocument document = super.createDocument(element);
		System.out.println("JSPDocumentProvider.createDocument start!!!");
		if (document != null) { 
			IDocumentPartitioner partitioner = 
					new DefaultPartitioner(
							new HTMLPartitionScanner(),
							TYPES);
			partitioner.connect(document); 
			document.setDocumentPartitioner(partitioner); 
		}
		return document; 
	}

}
